﻿<!--
// (c) Copyright Microsoft Corporation.
// This source is subject to the Microsoft Public License (Ms-PL).
// Please see http://go.microsoft.com/fwlink/?LinkID=131993 for details.
// All other rights reserved.
-->

<ResourceDictionary
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:controls="using:WinRTXamlToolkit.Controls">
    <Style
        TargetType="controls:TreeViewItem">
        <Setter
            Property="Padding"
            Value="3" />
        <Setter
            Property="HorizontalContentAlignment"
            Value="Left" />
        <Setter
            Property="VerticalContentAlignment"
            Value="Top" />
        <Setter
            Property="Background"
            Value="Transparent" />
        <Setter
            Property="BorderThickness"
            Value="1" />
        <!--<Setter Property="Cursor" Value="Arrow" />-->
        <Setter
            Property="IsTabStop"
            Value="True" />
        <Setter
            Property="TabNavigation"
            Value="Once" />
        <Setter
            Property="Margin"
            Value="0 1 0 0" />
        <Setter
            Property="Template">
            <Setter.Value>
                <ControlTemplate
                    TargetType="controls:TreeViewItem">
                    <Grid
                        Background="{x:Null}">
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup
                                x:Name="CommonStates">
                                <VisualState
                                    x:Name="Normal" />
                                <VisualState
                                    x:Name="MouseOver" />
                                <VisualState
                                    x:Name="Pressed" />
                                <VisualState
                                    x:Name="Disabled">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames
                                            Storyboard.TargetName="Header"
                                            Storyboard.TargetProperty="Foreground"
                                            Duration="0">
                                            <DiscreteObjectKeyFrame
                                                KeyTime="0">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <SolidColorBrush
                                                        Color="#FF999999" />
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                            <VisualStateGroup
                                x:Name="SelectionStates">
                                <VisualState
                                    x:Name="Unselected" />
                                <VisualState
                                    x:Name="Selected">
                                    <Storyboard>
                                        <DoubleAnimation
                                            Storyboard.TargetName="Selection"
                                            Storyboard.TargetProperty="Opacity"
                                            Duration="0"
                                            To=".75" />
                                    </Storyboard>
                                </VisualState>
                                <VisualState
                                    x:Name="SelectedInactive">
                                    <Storyboard>
                                        <DoubleAnimation
                                            Storyboard.TargetName="Selection"
                                            Storyboard.TargetProperty="Opacity"
                                            Duration="0"
                                            To=".2" />
                                        <ColorAnimation
                                            Storyboard.TargetName="SelectionFill"
                                            Storyboard.TargetProperty="Color"
                                            Duration="0"
                                            To="#FF999999" />
                                        <ColorAnimation
                                            Storyboard.TargetName="SelectionStroke"
                                            Storyboard.TargetProperty="Color"
                                            Duration="0"
                                            To="#FF333333" />
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                            <VisualStateGroup
                                x:Name="HasItemsStates">
                                <VisualState
                                    x:Name="HasItems" />
                                <VisualState
                                    x:Name="NoItems">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames
                                            Storyboard.TargetName="ExpanderButton"
                                            Storyboard.TargetProperty="Visibility"
                                            Duration="0">
                                            <DiscreteObjectKeyFrame
                                                KeyTime="0"
                                                Value="Collapsed" />
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                            <VisualStateGroup
                                x:Name="ExpansionStates">
                                <VisualState
                                    x:Name="Collapsed" />
                                <VisualState
                                    x:Name="Expanded">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames
                                            Storyboard.TargetName="ItemsHost"
                                            Storyboard.TargetProperty="Visibility"
                                            Duration="0">
                                            <DiscreteObjectKeyFrame
                                                KeyTime="0"
                                                Value="Visible" />
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                        <Grid.RowDefinitions>
                            <RowDefinition
                                Height="Auto" />
                            <RowDefinition
                                Height="*" />
                        </Grid.RowDefinitions>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition
                                Width="15" />
                            <ColumnDefinition
                                Width="Auto" />
                            <ColumnDefinition
                                Width="*" />
                        </Grid.ColumnDefinitions>

                        <ToggleButton
                            x:Name="ExpanderButton"
                            HorizontalAlignment="Stretch"
                            VerticalAlignment="Stretch"
                            IsTabStop="False"
                            TabNavigation="Once">
                            <ToggleButton.Template>
                                <ControlTemplate
                                    TargetType="ToggleButton">
                                    <Grid
                                        x:Name="Root"
                                        Background="Transparent">
                                        <VisualStateManager.VisualStateGroups>
                                            <VisualStateGroup
                                                x:Name="CommonStates">
                                                <VisualState
                                                    x:Name="Normal" />
                                                <VisualState
                                                    x:Name="Disabled">
                                                    <Storyboard>
                                                        <DoubleAnimation
                                                            Storyboard.TargetName="Root"
                                                            Storyboard.TargetProperty="Opacity"
                                                            To=".7"
                                                            Duration="0" />
                                                    </Storyboard>
                                                </VisualState>
                                                <VisualState
                                                    x:Name="PointerOver">
                                                    <Storyboard>
                                                        <ColorAnimation
                                                            Storyboard.TargetName="UncheckedVisual"
                                                            Storyboard.TargetProperty="(Path.Stroke).Color"
                                                            To="#FF1BBBFA"
                                                            Duration="0" />
                                                    </Storyboard>
                                                </VisualState>
                                                <VisualState
                                                    x:Name="Pressed">
                                                    <Storyboard>
                                                        <ColorAnimation
                                                            Storyboard.TargetName="UncheckedVisual"
                                                            Storyboard.TargetProperty="(Path.Stroke).Color"
                                                            To="#FF1BBBFA"
                                                            Duration="0" />
                                                    </Storyboard>
                                                </VisualState>
                                                <VisualState
                                                    x:Name="Checked">
                                                    <Storyboard>
                                                        <DoubleAnimation
                                                            Storyboard.TargetName="UncheckedVisual"
                                                            Storyboard.TargetProperty="Opacity"
                                                            To="0"
                                                            Duration="0" />
                                                        <DoubleAnimation
                                                            Storyboard.TargetName="CheckedVisual"
                                                            Storyboard.TargetProperty="Opacity"
                                                            To="1"
                                                            Duration="0" />
                                                    </Storyboard>
                                                </VisualState>
                                                <VisualState
                                                    x:Name="CheckedPointerOver">
                                                    <Storyboard>
                                                        <DoubleAnimation
                                                            Storyboard.TargetName="UncheckedVisual"
                                                            Storyboard.TargetProperty="Opacity"
                                                            To="0"
                                                            Duration="0" />
                                                        <DoubleAnimation
                                                            Storyboard.TargetName="CheckedVisual"
                                                            Storyboard.TargetProperty="Opacity"
                                                            To="1"
                                                            Duration="0" />
                                                        <ColorAnimation
                                                            Storyboard.TargetName="CheckedVisual"
                                                            Storyboard.TargetProperty="(Path.Fill).Color"
                                                            To="#FF1BBBFA"
                                                            Duration="0" />
                                                    </Storyboard>
                                                </VisualState>
                                                <VisualState
                                                    x:Name="CheckedPressed">
                                                    <Storyboard>
                                                        <DoubleAnimation
                                                            Storyboard.TargetName="UncheckedVisual"
                                                            Storyboard.TargetProperty="Opacity"
                                                            To="0"
                                                            Duration="0" />
                                                        <DoubleAnimation
                                                            Storyboard.TargetName="CheckedVisual"
                                                            Storyboard.TargetProperty="Opacity"
                                                            To="1"
                                                            Duration="0" />
                                                        <ColorAnimation
                                                            Storyboard.TargetName="CheckedVisual"
                                                            Storyboard.TargetProperty="(Path.Fill).Color"
                                                            To="#FF1BBBFA"
                                                            Duration="0" />
                                                    </Storyboard>
                                                </VisualState>
                                                <VisualState
                                                    x:Name="CheckedDisabled">
                                                    <Storyboard>
                                                        <DoubleAnimation
                                                            Storyboard.TargetName="Root"
                                                            Storyboard.TargetProperty="Opacity"
                                                            To=".7"
                                                            Duration="0" />
                                                        <DoubleAnimation
                                                            Storyboard.TargetName="UncheckedVisual"
                                                            Storyboard.TargetProperty="Opacity"
                                                            To="0"
                                                            Duration="0" />
                                                        <DoubleAnimation
                                                            Storyboard.TargetName="CheckedVisual"
                                                            Storyboard.TargetProperty="Opacity"
                                                            To="1"
                                                            Duration="0" />
                                                    </Storyboard>
                                                </VisualState>
                                                <VisualState
                                                    x:Name="Indeterminate" />
                                                <VisualState
                                                    x:Name="IndeterminatePointerOver" />
                                                <VisualState
                                                    x:Name="IndeterminatePressed" />
                                                <VisualState
                                                    x:Name="IndeterminateDisabled" />
                                            </VisualStateGroup>
                                            <VisualStateGroup
                                                x:Name="CheckStates">
                                                <VisualState
                                                    x:Name="Unchecked" />
                                                <VisualState
                                                    x:Name="Checked2" />
                                            </VisualStateGroup>
                                        </VisualStateManager.VisualStateGroups>
                                        <Grid
                                            HorizontalAlignment="Right"
                                            Margin="2 2 5 2">
                                            <Path
                                                x:Name="UncheckedVisual"
                                                Width="6"
                                                Height="9"
                                                Fill="#FFFFFFFF"
                                                VerticalAlignment="Center"
                                                HorizontalAlignment="Right"
                                                Data="M 0,0 L 0,9 L 5,4.5 Z"
                                                StrokeThickness="1"
                                                StrokeLineJoin="Miter">
                                                <Path.Stroke>
                                                    <SolidColorBrush
                                                        Color="#FF989898" />
                                                </Path.Stroke>
                                            </Path>
                                            <Path
                                                x:Name="CheckedVisual"
                                                Opacity="0"
                                                Width="6"
                                                Height="6"
                                                Fill="#FF262626"
                                                VerticalAlignment="Center"
                                                HorizontalAlignment="Center"
                                                Data="M 6,0 L 6,6 L 0,6 Z"
                                                StrokeLineJoin="Miter" />
                                        </Grid>
                                    </Grid>
                                </ControlTemplate>
                            </ToggleButton.Template>
                        </ToggleButton>
                        <Rectangle
                            x:Name="Selection"
                            Grid.Column="1"
                            Opacity="0"
                            StrokeThickness="1"
                            IsHitTestVisible="False"
                            RadiusX="2"
                            RadiusY="2">
                            <Rectangle.Fill>
                                <SolidColorBrush
                                    x:Name="SelectionFill"
                                    Color="#FFBADDE9" />
                            </Rectangle.Fill>
                            <Rectangle.Stroke>
                                <SolidColorBrush
                                    x:Name="SelectionStroke"
                                    Color="#FF6DBDD1" />
                            </Rectangle.Stroke>
                        </Rectangle>
                        <Button
                            x:Name="Header"
                            Grid.Column="1"
                            ClickMode="Hover"
                            Background="{TemplateBinding Background}"
                            Foreground="{TemplateBinding Foreground}"
                            BorderBrush="{TemplateBinding BorderBrush}"
                            BorderThickness="{TemplateBinding BorderThickness}"
                            HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                            VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
                            IsTabStop="False"
                            TabNavigation="Once">
                            <!--Cursor="{TemplateBinding Cursor}"-->
                            <Button.Template>
                                <ControlTemplate
                                    TargetType="Button">
                                    <Grid
                                        Background="{TemplateBinding Background}">
                                        <VisualStateManager.VisualStateGroups>
                                            <VisualStateGroup
                                                x:Name="CommonStates">
                                                <VisualState
                                                    x:Name="Normal" />
                                                <VisualState
                                                    x:Name="Pressed">
                                                    <Storyboard>
                                                        <DoubleAnimation
                                                            Storyboard.TargetName="Hover"
                                                            Storyboard.TargetProperty="Opacity"
                                                            Duration="0"
                                                            To=".5" />
                                                    </Storyboard>
                                                </VisualState>
                                                <VisualState
                                                    x:Name="Disabled">
                                                    <Storyboard>
                                                        <DoubleAnimation
                                                            Storyboard.TargetName="Content"
                                                            Storyboard.TargetProperty="Opacity"
                                                            Duration="0"
                                                            To=".55" />
                                                    </Storyboard>
                                                </VisualState>
                                            </VisualStateGroup>
                                        </VisualStateManager.VisualStateGroups>
                                        <Rectangle
                                            x:Name="Hover"
                                            Opacity="0"
                                            Fill="#FFBADDE9"
                                            Stroke="#FF6DBDD1"
                                            StrokeThickness="1"
                                            IsHitTestVisible="False"
                                            RadiusX="2"
                                            RadiusY="2" />
                                        <ContentPresenter
                                            x:Name="Content"
                                            Content="{TemplateBinding Content}"
                                            ContentTemplate="{TemplateBinding ContentTemplate}"
                                            HorizontalAlignment="Left"
                                            Margin="{TemplateBinding Padding}" />
                                        <!--Cursor="{TemplateBinding Cursor}"-->
                                    </Grid>
                                </ControlTemplate>
                            </Button.Template>
                            <Button.Content>
                                <ContentPresenter
                                    Content="{TemplateBinding Header}"
                                    ContentTemplate="{TemplateBinding HeaderTemplate}" />
                            </Button.Content>
                        </Button>

                        <ItemsPresenter
                            x:Name="ItemsHost"
                            Grid.Row="1"
                            Grid.Column="1"
                            Grid.ColumnSpan="2"
                            Visibility="Collapsed" />
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
</ResourceDictionary>